Part Number Hot Search : 
80NT3 2PFR2 BD121 MBB50A6 22F09 MAX458 21UHR MOB81DR
Product Description
Full Text Search
 

To Download DS2790 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
 DS2790
Programmable 1-Cell Li-Ion Fuel Gauge and Protector
www.maxim-ic.com
GENERAL DESCRIPTION
The DS2790 provides a complete fuel gauging and protection solution for single cell Li-Ion battery packs. A low-power 16-bit MAXQ20 microcontroller with generous program and data memory, combined with an accurate measurement system for battery current, voltage, and temperature provide the ideal platform for customized fuelgauge algorithms. The 2-wire 2 interface provides an I C*- or SMBusa-compatible communication path between the host and battery pack, while providing password protected programming of the fuel-gauging firmware. EEPROM data memory supports nonvolatile in-pack storage of charge parameters, cell characteristics, usage history, and manufacturing/lot tracking data. An autonomous state machine performs voltage, current, and temperature related protection functions. This capability increases reliability of the whole system by eliminating dependence on the CPU for protection. The DS2790 supports Li-Ion batteries in a wide range of applications.
FEATURES
Accurate Current Measurement for Coulomb Counting (Current Accumulation) 1.5% 4V over 64mV Input Range 1.5% 267A over 4.2A Range Using an External 15mW Series Resistor High Resolution Current Reporting 12-bit + Sign Average Every 0.88ms 15-bit + sign Average Every 2.8s Voltage Measurement 10-bit Average Temperature Measurement 10-bit Using On-Chip Sensor 16-bit MAXQ20 Low Power Microcontroller Efficient C-Language Programming 8k words Total Program Memory - 4k Words EEPROM Program Memory - 4k Words ROM Program Memory 64 Words Data EEPROM 256 Words Data RAM State Machine-Driven Protection Protection Independent of CPU Operation Programmable Levels for: - Overvoltage/Undervoltage - Overcurrent - Temperature Limits Lithium-Ion Protector Drives Highside N-FETs Industry Standard 400kHz 2-Wire interface Password Protected Programming Operates as Low as 2.5V Input on VDD SHA-1 Hash Algorithm in ROM Internal Oscillator3/4No Crystal Required Low Power Consumption 3.3mA CPU Mode (1MHz), 280A Analog Mode, 4.5A Sleep Mode

TYPICAL OPERATING CIRCUIT
1nF x 2
PACK+

0.1F 0.1F
PIN CONFIGURATION
See last page for TSSOP and TDFN packages.
Note: Some revisions of this device may incorporate deviations from published specifications known as errata. Multiple revisions of any device may be simultaneously available through various sales channels. For information about device errata, click here: www.maxim-ic.com/errata.
100W
100W
1KW
1KW
1KW
CC VIN VDD CP
DC PLS [P0.0 - P0.5]
6
DS2790
AVSS VSS SNS1 IS1 0.1mF RSNS 2.5V (1)
SCL SDA SNS2 IS2 5.6V (1)
150W
CLK
150W DATA
5.6V (1)
ORDERING INFORMATION
PACK-
(1) Optional for 8kV/15kV ESD
PART DS2790E+ DS2790G+
TEMP RANGE -20C to +70C -20C to +70C
PIN-PACKAGE TSSOP-28 TDFN-28
Contact factory concerning Mask ROM devices. + Denotes lead-free package. MAXQ is a registered trademark of Maxim Integrated Products, Inc. SMBus is a trademark of Intel Corp. * I2C is a Philips Corp. trademark. See acknowledgement at the end of the data sheet.
1 of 41
REV: 080206
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector
ABSOLUTE MAXIMUM RATINGS
PLS to VSS ................................................................................................................................................ -0.3V to +18V CP to VSS ................................................................................................................................................. -0.3V to +12V DC to VSS ........................................................................................................................................... -0.3V to CP+0.3V CC to VSS .................................................................................................................................... VDD -0.3V to CP+0.3V P0.4, P0.5 to VSS...............................................................................................................................-0.3V to VDD +0.3V AVSS to VSS ............................................................................................................................................ -0.3V to +0.3V All other pins to VSS.................................................................................................................................... -0.3V to +6V SCL, SDA, P0.0-P0.5 Continous Sink Current ...................................................................... 20mA Each, 50mA Total P0.4, P0.5 Continous Source Current .................................................................................... 20mA Each, 50mA Total CC, DC Continuous Source/Sink Current...............................................................................................................5mA Operating Temperature Range.............................................................................................................. -40C to +85C Storage Temperature Range ............................................................................................................... -55C to +125C Soldering Temperature ............................................................................. See IPC/JEDEC J-STD-020A Specification
Stresses beyond those listed under "Absolute Maximum Ratings" may cause permanent damage to the device. These are stress ratings only, and functional operation of the device at these or any other conditions beyone those indicated in the operational sections of the specifications is not implied. Exposure to the absolute maximum rating conditions for extended periods may affect device.
DC ELECTRICAL SPECIFICATIONS
(VDD = 2.5V to 5.5V, TA = -20C to +70C unless otherwise noted. Typical values are at VDD = 3.7, TA = +25C)
PARAMETER SYMBOL ICPU IANALOG Supply Current ISLEEP CONDITIONS CPU Mode (Note 1, 2) ANALOG Mode (Note 2) SLEEP Mode, (Note 2) SLEEP Mode, (Note 2) VDD = 4.2V, TA 50C SLEEP Mode, (Note 2) VDD = 2.5V, TA 50C (Note 3) (Note 3) MIN TYP 1.5 160 MAX 3.3 280 12.0 2.5 1.7 2.0 1.5 1.0 20 OSCA Active From SLEEP, OSCA Inactive (Note 3) (Note 3) (Note 3) VIH1 VIL1 VIH2 VIL2 VOL1 VOH1 IPD1 IPU1 IPU2 (Note 3) (Note 3) (Note 3) (Note 3) IOL = 4mA, (Note 3) IOH = -4mA, PPU[5:4] set, (Note 3) VPIN = VIL1, PPU[7:6] clear VPIN = VIH1, PPU[7:6] set VPIN = VIH2, PPU[3:0] set VDD - 0.5 0.3 0.3 0.15 1.2 1.2 4 3.0 3.0 22 1.0 700 -0.3 -0.3 -0.3 1.5 0.6
0.7 x VDD 0.3 x VDD
UNITS mA mA
4.5 3.5 2.4
mA
Brownout Voltage Power-On Reset Voltage Internal System Clock System Clock Error System Clock Startup PLS Voltage Range P0.4-P0.5 Voltage Range P0.0-P0.3, SCL, SDA Voltage Range SCL, SDA, Input Logic High SCL, SDA, Input Logic Low P0.0 - P0.5, Input Logic High P0.0 - P0.5, Input Logic Low SCL, SDA, P0.0-P0.5 Output Logic Low: P0.4-P0.5 Output Logic High: SCL, SDA Pulldown Current SCL, SDA Pullup Current P0.0-P0.3 Pullup Current
VBO VPOR fOSCI fERR:OSCI tSU:OSCI
V V MHz % s
15 VDD + 0.3 +5.5
V V V V V V V V V mA mA mA
0.4
2 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector
PARAMETER P0.0-P0.5 Pulse Rejection Current Measurement Input Range (Full Scale) Current Measurement Resolution Current Measurement Offset Error Current Measurement Gain Error Accumulated Current Offset Temperature Measurement Resolution Temperature Measurement Error Voltage Full Scale Voltage Measurement Resolution Voltage Measurement Error VIN Input Resistance Current Measurement Sample Frequency Analog Timebase Frequency Analog Timebase Error Filter Resistors IS1 to SNS1, IS2 to SNS2 EEPROM Copy Time EEPROM Copy Endurance Data EEPROM EEPROM Copy Endurance Program EEPROM SYMBOL tPR VIS1-VIS2 ILSB IOERR IGERR qCA TLSB TERR VFS VLSB VERR RIN fSAMP fOSCA fERR:OSCA RKS tEEC NEECD NEECP VDD 2.8V VDD 2.8V , TA = 50C VDD 2.8V , TA = 50C 50,000 1000 VDD 4.5V, TA = 25 C
o
CONDITIONS Rising and Falling Edges
MIN
TYP 100
MAX
UNITS ns
-64 15.625 -7.8 -0.8 OBEN = 1 OBEN = 1, RSNS = 0.015W -94 -6.3 0.125 -3 (Note 4) 0 4.88 -20 15 1456 70 -0.7 -2 10 10
+64
mV mV/RSNS
+7.8 +0.8 0 0
mV/RSNS % Full Scale mVh/day mAh/day
o o
C C
+3 4.992
V mV
+20
mV M Hz KHz
+0.7 +2
% k
15
ms cycles cycles
ELECTRICAL CHARACTERISTICS: PROTECTION CIRCUITRY
(2.5V VDD 5.5V, TA = 0C to +50C.)
PARAMETER Output Low: CC Output Low: DC Output High: CC Output High: DC Output Resistance: CC, DC Output Voltage: CP Overvoltage Detect Charge Enable SYMBOL VOLCC VOLDC VOHCC VOHDC RO VOCP VOV VCE CONDITIONS IOL = 0.1mA, (Note 3) IOL = 0.1mA, (Note 3) IOH = -0.1mA, (Note 3) IOH = -0.1mA, (Note 3) VOCP = 9V, VPIN = VSS ICC + IDC 0.9mA, (Note 3) OV = 01010b, (Note 3) OV = 01010b, (Note 3) 8.5 4.330 4.230 9.0 4.350 4.250
VOCP - 0.25 VOCP - 0.25
MIN
TYP
MAX
VDD + 0.1 0.1
UNITS V V V V
2.0 9.5 4.370 4.270
k V V V
3 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector
PARAMETER Undervoltage Detect Charge and Discharge Overcurrent Detect (Limits for Charge Thresholds are Positive, While Discharge is Negative.) VOC SYMBOL VUV CONDITIONS UVF = 10111b, (Note 3) COCT = DOCT = 00b COCT = DOCT = 01b COCT = DOCT = 10b COCT = DOCT = 11b DOCT = 00b Short-Circuit Detect VSC DOCT = 01b DOCT = 10b DOCT = 11b Overvoltage Delay Undervoltage Delay Overcurrent Delay Short-Circuit Delay Secondary Short-Circuit Delay Test Threshold Test Current Pulldown Current, PLS Recovery Charge Current tOVD tUVD tOCD tSCD tSSCD VTP ITST IPD IRC Sleep Mode VPLS = 5.0V, VDD = 2.0V 0.5 SCDT = 1 SCDT = 0 (Note 5) MIN 2.430 15.6 31.2 47.0 62.7 75 105 135 165 0.8 75 15 1.5 187 20 0.3 10 1.0 20 200 1 2 TYP 2.450 16 32 48 64 100 140 180 220 1 100 20 2 250 MAX 2.470 16.4 32.8 49.0 65.3 125 175 225 275 1.2 125 25 2.5 313 200 1.5 40 UNITS V mV mV mV mV mV mV mV mV s ms ms ms ms ms V mA mA mA
ELECTRICAL CHARACTERISTICS: 2-WIRE INTERFACE
(2.5V VDD 5.5V, TA = -20C to +70C.)
PARAMETER SCL Clock Frequency Bus Free Time Between a STOP and START Condition Hold Time (Repeated) START Condition Low Period of SCL Clock High Period of SCL Clock Setup Time for a Repeated START Condition Data Hold Time Data Setup Time Rise Time of both SDA and SCL Signals Fall Time of both SDA and SCL Signals SYMBOL fSCL tBUF tHD:STA tLOW tHIGH tSU:STA tHD:DAT tSU:DAT tR tF (Note 7, 8) (Note 7) (Note 9) (Note 9) (Note 6) CONDITIONS MIN 0 1.3 0.6 1.3 0.6 0.6 0 100 20+0.1CB 20+0.1CB 300 300 0.9 TYP MAX 400 UNITS KHz s s s s s s ns ns ns
4 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector
PARAMETER Setup Time for STOP Condition Spike Pulse Width that can be Suppressed by Input Filter Clock Low Time-Out Cumulative Clock Low Extend Time for Slave Device Cumulative Clock Low Extend Time for Bus Master SCL, SDA Input Capacitance SYMBOL tSU:STO tSP tTIMEOUT tLOW:SEXT tLOW:MEXT CBIN (Note 10) TTO_DIS = 0, (Note 11) TLS_DIS = 0, (Note 12) TTO_DIS = 0, TLS_DIS = 0 (Note 13) CONDITIONS MIN 0.6 0 25 50 35 25 10 60 TYP MAX UNITS s ns ms ms ms pF
ELECTRICAL CHARACTERISTICS: JTAG INTERFACE
(2.5V VDD 5.5V, TA = -20C to +70C.)
PARAMETER JTAG Logic Reference TCK High Time TCK Low Time TCK Low to TDO Output TMS, TDI Input Setup to TCK High TMS, TDI Input Hold after TCK High
Note 1: Note 2: Note 3: Note 4: Note 5: Note 6: Note 7: Note 8: Note 9: Note 10: Note 11:
SYMBOL VREF tTH tTL tTLQ tDVTH tTHDX
CONDITIONS
MIN
TYP VDD / 2
MAX
UNITS V s s
4.0 4.0 1.0 1.0 4.0
s s s
Note 12: Note 13:
Maximum current assumuing 100% CPU duty cycle. This value does not include current in SDA, SCL, and P0.0-P0.5. All Voltages referenced to VSS. Voltage register can report up to 4.992V, however VIN pin input saturation occurs at 4.75V minimum. The secondary short circuit delay is measured from the falling transition on VDD to the resultant falling transition on DC. The delay is measured from the time VDD reaches VPOR - 0.5V to the time DC reaches 50% of VCP (4.5V). fSCL must meet the minimum clock low time plus the rise/fall times. The maximum tHD:DAT has only to be met if the device does not stretch the LOW period (tLOW) of the SCL signal. This device internally provides a hold time of at least 75ns for the SDA signal (referred to the VIHmin of the SCL signal) to bridge the undefined region of the falling edge of SCL. CB3/4total capacitance of one bus line in pF. Filters on SDA and SCL suppress noise spikes at the input buffers and delay the sampling instant. Devices participating in data transfer will timeout when any clock low exceeds the minimum tTIMEOUT of 25ms. Devices that have detected a timeout condition must reset the communication no later than the maximum tTIMEOUT of 35ms. The maximum value specified must be adhered to by both devices as it incorporates the cumulative stretch limit for the master (10ms) and slave device (25ms). tLOW:SEXT is the cumulative time the slave is allowed to extend the clock from the initial START to the STOP. If the DS2790 exceeds this time, it will release both SDA and SCL and reset the communication interface. tLOW:MEXT is the cumulative time the master is allowed to extend the clock cycles within each byte of a communication sequence. If the bus master exceeds this time it is possible for the DS2790 to violate tTIMEOUT without having violated tLOW:SEXT.
5 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector
Figure 1. 2-Wire Bus Timing Diagram
SDA
tF tLOW tR
tSU;DAT
tF
tHD;STA
tSP
tR
tBUF
SCL
tHD;STA S
tHD;DAT
tSU;STA Sr
tSU;STO P S
Figure 2. JTAG Timing Diagram
t TL
TCK
VREF
t TH
TMS / TDI
tDVTH
tTHDX
TDO
tTLQ
6 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector
PIN DESCRIPTION
PIN 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 NAME N.C. N.C. CP PLS DC CC SCL SDA P0.0 P0.1 SNS2 IS2 N.C. N.C. N.C. N.C. IS1 SNS1 AVSS VSS P0.2 P0.3 P0.4 P0.5 VDD VIN N.C. N.C. PAD No Connection No Connection Charge Pump Output. Bypass CP to VSS with 0.1mF. Pack Plus. Positive pack terminal connection. Discharge Control. Discharge FET gate drive output. Charge Control. Charge FET gate drive output. 2-wire Serial Interface Clock Input and Output 2-wire Serial Interface Data Input and Output Programmable I/O Pin. Alternate functions: external interrupt input INT0, [JTAG TDI]. Programmable I/O Pin. Alternate functions: External interrupt input INT1, [JTAG TMS]. Current Sense Input. SNS2 attaches to pack end of current sense resistor. Current Filter Input 2 No Connection No Connection No Connection No Connection Current Filter Input 1 Current Sense Input. SNS1 attaches to battery end of current sense resistor and VSS. Analog Supply Return Node. AVSS attaches to negative battery terminal. Digital Supply Return Node. VSS attaches to negative battery terminal. Programmable I/O Pin. Alternate functions: Reset input pin RST. Programmable I/O Pin. Alternate functions: Timer/Counter input pin TCK, [JTAG TCK]. Programmable I/O Pin. Alternate function: [JTAG TDO] Programmable I/O Pin Input Supply: +2.5V to +5.5V input range. Bypass VDD to VSS with 0.1mF. Battery voltage sense input, measurement relative to AVSS. No Connection No Connection Exposed PAD (TDFN only). Not electrically connected to IC. Connect to VSS or leave floating. DESCRIPTION
7 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector
FUNCTIONAL DIAGRAM
VOLTAGE (VIN - AVSS) PRECISION ANALOG OSCILLATOR A/D CONTROL TEMPERATURE
CURRENT (IS1 - IS2)
ANALOG FRONT END ADC / MUX
VIN SNS1 IS1 IS2 SNS2
AVG CURRENT
ANALOG REGISTERS TTCK 0:1 CLK DIV P0.3 TIMER/ COUNTER TCI BOI, VI, CI, TI VREF
AVSS
SCI, SDI, SNDI
I2C INTERFACE AND BOOTLOADER
Tx Rx
P0.0/INT0/TDI P0.1/INT1/TMS P0.2/RST P0.3/TCK P0.4/TDO P0.5 SDA SCL
WATCHDOG TIMER
WDI
INTERRUPT CONTROLLER
INT0, INT1 PORT PIN DRIVERS
CCI, BEI SNS1 SNS2 PLS VDD LITHIUM ION PROTECTOR SENSE & CONTROL MAXQ20 16-BIT RISC CORE FET DRIVERS DC CP FET CHARGE PUMP INSTRUCTION OSCILLATOR (1MHz) REGISTER FILE DP[0] DP[1] BP[Offs] 256 X 16 SRAM (DATA)
CC 4K X 16 ROM (UTILITY) 4K X 16 EEPROM (PROGRAM) 64 X 16 EEPROM (DATA)
VDD
VDD_INT VSS VSS_INT P0.3/TCK P0.1/TMS P0.0/TDI P0.4/TDO
JTAG BOOTLOAD AND DEBUG INTERFACE
EEPROM CHARGE PUMP
DS2790
8 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector
DETAILED DESCRIPTION
The following is an introduction to the primary features of the DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector. More detailed descriptions of the device features can be found in the errata sheets, and user's guides described later in the Additional Documentation section.
DS2790 Overview
The DS2790 incorporates the 16-bit MAXQ20 microcontroller core with 16 accumulators and 16-level hardware stack. Four memory blocks provide application code space, utility code space, RAM memory, and EEPROM memory. Specialized peripherals are integrated to perform battery monitoring, coulomb counting, Lithium-Ion protection, and 2-wire communication functions. The MAXQ20 core along with the specialized peripherals provide a flexible solution for fuel gauging and protection of Lithium-Ion battery packs. Flexibility is further enhanced as the solution allows for upgrading of the program and data EEPROM contents over the 2-wire interface. Updates to the program and data EEPROM are protected against unauthorized writes by a 256-bit user password. A read protection bit is provided to prevent reading either EEPROM.
MAXQ20 Core Architecture
The DS2790 employs a MAXQ20 low-cost, high-performance, CMOS, fully static, 16-bit RISC microcontroller with EEPROM memory. It is structured on a highly advanced, 16 accumulator-based, 16-bit RISC architecture. Fetch and execution operations are completed in one cycle without pipelining, since the instruction contains both the op code and data. The highly efficient core is supported by 16 accumulators and a 16-level hardware stack, enabling fast subroutine calling and task switching. Data can be quickly and efficiently manipulated with three internal data pointers. Multiple data pointers allow more than one function to access data memory without having to save and restore data pointers each time. The data pointers can automatically increment or decrement following an operation, eliminating the need for software intervention.
Instruction Set
The instruction set is composed of fixed-length, 16-bit instructions that operate on registers and memory locations. The instruction set is highly orthogonal, allowing arithmetic and logical operations to use any register along with the accumulator. Special-function registers control the peripherals and are subdivided into register modules. The family architecture is modular, so that new devices and modules can reuse code developed for existing products The architecture is transport-triggered. This means that writes or reads from certain register locations can also cause side effects to occur. These side effects from the basis for higher-level op codes defined by the assembly, such as ADDC, OR, JUMP, etc. The op codes are implemented as MOVE instructions between certain register locations, while the assembler handles the encoding, which need not be a concern to the programmer. The 16-bit instruction word is designed for efficient execution. Bit 15 indicates the format for the source field of the instruction. Bits 0 to 7 of the instruction represent the source for the transfer. Depending on the value of the format field, this can either be an immediate value or a source register. If this field represents a register, the lower four bits contain the module specifier and the upper four bits contain the register index in that module. Bits 8 to 14 represent the destination for the transfer. This value always represents a destination register, with the lower four bits containing the module specifier and the upper three bits containing the register subindex within that module. Any time that it is necessary to directly select one of the upper 24 registers as a destination, the prefix register PFX is needed to supply the extra destination bits. This prefix register write is inserted automatically by the assembler and requires only one additional execution cycle. See the MAXQ Family User's Guide for complete instruction set information.
9 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector
Memory Organization
The DS2790 incorporates several memory areas: * 4k words of utility ROM contain a debugger, program loader, and SHA-1 routines * 4k words of EEPROM memory for application program storage * 256 words of SRAM for storage of temporary variables * 64 words of EEPROM memory for data storage * 8 words of ADC conversion data information * 16-level stack memory for storage of program return addresses and general-purpose use The memory is implemented using the Harvard architecture, with separate address spaces for program and data memory. A pseudo-Von Neumann memory map is also utilized placing ROM, application code, and data memory into a single contiguous memory map. The pseudo-Von Neumann memory map allows data memory to be mapped into program space, permitting code execution from data memory. In addition program memory may be mapped into data space, permitting code constants to be accessed as data memory. Figure 4 shows the DS2790's memory map when executing from program memory space. See the MAXQ Family User's Guide: DS2790 Supplement for memory map information when executing from data or ROM space. The incorporation of EEPROM memory allows field upgrade of the firmware. EEPROM memory can be password protected with a 16-word key, denying access to program memory by unauthorized individuals. ROM memory is also available for high-volume, low-cost applications. Contact Dallas Semiconductor for more information on the availability of ROM-based devices.
Figure 4. DS2790 Memory Map
SYSTEM REGISTERS 8h 9h Bh Ch Dh Eh Fh 00h AP A PFX IP SP DPC DP 0Fh 8000h PERIPHERAL REGISTERS 0h 1h 2h 00h M0 M1 M2 1Fh 0FFFh 027Fh 4K x 16 USER PROGRAM MEMORY 0200h 01FFh 0000h 128 x 8 EEPROM DATA 013Fh 0100h 00FFh 0000h 64 x 16 EEPROM DATA 600Ah 6003h 8 x 16 ADC DATA 4K x 16 UTILITY ROM 8000h 8FFFh 9FFFh 4K x 16 UTILITY ROM 8000h 8FFFh 4K x 16 UTILITY ROM PROGRAM MEMORY SPACE FFFFh DATA MEMORY (BYTE MODE) FFFFh DATA MEMORY (WORD MODE)
FFFFh
16 x 16 STACK 0000h
512 x 8 SRAM DATA
256 x 16 SRAM DATA
10 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector
Stack Memory
A 16-bit, 16-level internal stack provides storage for program return addresses and general-purpose use. The stack is used automatically by the processor when the CALL, RET, and RETI instructions are executed and interrupts serviced. The stack can also be used explicitly to store and retrieve data by using the PUSH, POP, and POPI instructions. On reset, the stack pointer, SP, initializes to the top of the stack (0Fh). The CALL, PUSH, and interrupt-vectoring operations increment SP, then store a value at the location pointed to by SP. The RET, RETI, POP, and POPI operations retrieve the value at "@SP" and then decrement SP.
Utility ROM
The utility ROM is a 4k word block of internal ROM memory that defaults to a starting address of 8000h. The utility ROM consists of subroutines that can be called from application software. These include: * * * * In-system programming (bootstrap loader) over JTAG or 2-wire interfaces In-circuit debug routines Internal self-test routines callable routines for in-application EEPROM programming and SHA-1 calculations
Following any reset, execution begins in the utility ROM. The ROM software determines whether the program execution should immediately jump to location 0000h, the start of application code, or to one of the special routines mentioned. Routines within the utility ROM are firmware-accessible and can be called as subroutines by the application software. More information on the utility ROM contents is contained in the MAXQ Family User's Guide: DS2790 Supplement. Some applications require protection against unauthorized viewing of program code memory. For these applications, access to in-system programming, in-application programming, or in-circuit debugging functions is prohibited until a password has been supplied. The password is defined as the 16 words of physical program memory at addresses x0010h to x001Fh. Upon startup, code in the ROM examines the password, if a password is defined (password is other than all zero's or all one's), the PWL bit remains set, which prohibits access to commands to read memory contents over the JTAG and 2-wire interfaces. A single Password Lock (PWL) bit is implemented in the SC register. When the PWL is set to one (power-on reset default), the password is required to access the utility ROM, including in-circuit debug and in-system programming routines that allow reading or writing of internal memory. When PWL is cleared to zero, these utilities are fully accessible without password. The password is automatically set to all ones following a mass erase.
PROGRAMMING
The EEPROM memory of the microcontroller can be programmed by two different methods: in-system programming and in-application programming. Both methods afford great flexibility in system design as well as reduce the life-cycle cost of the embedded system. These features can be password protected to prevent unauthorized access to code memory.
In-System Programming
An internal bootstrap loader allows the device to be programmed over the JTAG or 2-wire interfaces. As a result, system software can be upgraded in-system, eliminating the need for a costly hardware retrofit when software updates are required. Remote software uploads are possible that enable physically inaccessible applications to be frequently updated. The JTAG interface hardware can be a JTAG connection to another microcontroller, or a connection to a PC serial port using a serial to JTAG converter such as the MAXQJTAG-001, available from Maxim 2 Integrated Products. The 2-wire interface hardware can be an I C connection to another microcontroller, or a 2 connection to a PC USB port using a USB to I C converter such as the DS9123O, available from Dallas Semiconductor. A commercial gang programmer can also be used for programming.
11 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector Activating the JTAG interface and loading the Test Access Port (TAP) with the system programming instruction invokes the bootstrap loader for use over the JTAG interface. Setting the SPE bit to 1 during reset through the JTAG interface executes the bootstrap-loader-mode program that resides in the utility ROM. When programming is complete, the bootstrap loader can clear the SPE bit and reset the device, allowing the device to bypass the utility ROM and begin execution of the application software. Performing a program request over the 2-wire interface also invokes the bootstrap loader. The user must successfully complete a password match (If PWL = 1). The bootstrap loader functions are then fully supported over the 2-wire interface. When programming is complete, the exit loader function is used to reset the DS2790 and begin execution of the application software. The following bootstrap loader functions are supported: * * * * * * Information Commands Load EEPROM Code and Data Dump EEPROM Code and Data CRC EEPROM Code and Data Verify EEPROM Code and Data Erase EEPROM Code and Data
In-Application Programming
The in-application programming feature allows the microcontroller to modify its own EEPROM program memory. This allows on-the-fly software updates in mission-critical applications that cannot afford downtime. Alternatively, it allows the application to develop custom loader software that can operate under the control of the application software. The utility ROM contains firmware-accessible EEPROM programming functions that erase and program EEPROM memory. These functions are described in detail in the MAXQ Family User's Guide: DS2790 Supplement.
SYSTEM TIMING
The DS2790 generates its 1MHz instruction clock (OSCI) internally. This quick starting oscillator is used for instruction fetch and execution by the MAXQ20 core.. The analog oscillator (OSCA) is a band-gap based RC oscillator that is trimmed to better than 2% accuracy. The analog clock runs independent of OSCI and serves as the clock source for the ADC, watchdog timer, interval timer, and 2-wire timeouts. OSCI is enabled through either a system interrupt or system POR and disabled through a system STOP. A voltage brown out detection circuit disables OSCI if VDD falls below VBO. Once VDD raises above VBO, a hysteresis circuit waits tSU:OSCI before re-enabling OSCI. OSCA is enabled by the Watchdog Timer signals EWDI or EWT, the Timer / Counter (TMOD), or by the protection circuitry (PMM[1:0]).
Figure 5. System Clocks
OSCI Enable
STOP
EN
1MHz Oscillator
CLK D Q
Interrupt POR
OSCI
EN
Brown Out Detector
VDD < VBO
CLR
Brown Out Hysteresis (t SU:OSCI )
PMM.0 PMM.1 EWDI EWT TMOD
EN OSCA Enable
70kHz Oscillator
OSCA
12 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector
SYSTEM RESET
Several reset sources are provided for microcontroller control. Although code execution is halted in the reset state, OSCI continues to run. Power-On Reset - An internal power-on reset circuit enhances system reliability. This circuit forces the device to perform a power-on reset whenever a rising voltage on VDD climbs above VPOR. At this point the following events occur: * * * All registers and circuits enter their reset state, The POR flag (WDCN.7) is set to indicate the source of the reset, Code execution begins at location 8000h
Watchdog Timer Reset - A few differences exist between the watchdog timer in the DS2790 and the one described in the MAXQ Family User's Guide as described in the Watchdog Timer section. Software can determine if a reset is caused by a watchdog timeout by checking the Watchdog Timer Reset Flag (WTRF) in the WDCN register. Execution resumes at location 8000h following a watchdog timer reset. External System Reset - Asserting the external RST (port P0.2) pin low causes the device to enter the reset state. The external reset function is described in the MAXQ Family User's Guide. Execution resumes at location 8000h after the RST pin is released.
MAXQ20 CORE POWER MANAGEMENT
The DS2790 is designed for low power battery monitoring applications. The peripherals have been designed with the ability to wake the processor from Stop mode any time software intervention is needed. Power management is optimized in the applications by performing any necessary processing as quickly as possible, and re-entering the low power Stop mode. Processing resumes from stop mode via any of the following sources (when enabled): * * * * An external interrupt is triggered. An external reset signal is applied to the RST pin. A Watchdog Timer interrupt occurs. An internal interrupt event occurs.
No division of the internal system clock is supported, subsequently the PMME and CD[1:0] bits described in the MAXQ users guide are not implemented in the DS2790.
WATCHDOG TIMER
The watchdog timer provides a mechanism to reset the processor in the case of undesirable code execution. The watchdog timer is a hardware timer designed to be periodically reset by the application software. If the software operates correctly, the timer is reset before it reaches its maximum count. However, if undesireable code execution prevents a reset of the watchdog timer, the timer reaches its maximum count and resets the processor. The watchdog timer in the DS2790 differs in two respects from the one described in the MAXQ Family User's Guide: 1) the clock used by the timer is the 70kHz OSCA clock that runs independently of the 1MHz OSCI (or system) clock, and 2) the watchdog interrupt is an asynchronous interrupt that can bring the processor out of stop mode. The watchdog timer is controlled through bits in the WDCN register. Its timeout period can be set to one of the four 12 21 programmable intervals ranging from 2 to 2 OSCA clock periods ( 59ms up to 30s ). The watchdog interrupt occurs at the end of this timeout period, which is 512 OSCA clock periods, or 7.3ms, before the reset.
13 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector
DS2790 POWER MODES
When power is first applied to the DS2790, a Power-on-Reset (POR) circuit transitions the IC to Brown-Out State where cell voltage is monitored. If VDD voltage is above the brown-out threshold VBO, the DS2790 enters CPU state and begins code execution. Firmware determines if the IC switches to ANALOG State or low-power SLEEP States when a STOP halts CPU operation. The DS2790 enters SLEEP state after a CPU STOP if the ADC, the protector, and all internal timers are disabled. In SLEEP State, all IC operation becomes inactive except for external activity interrupts. Brown-Out detection does not occur in SLEEP State. Any interrupt generated by 2-wire port communication, external input on ports P0.0 or P0.1, or a charger detection on PLS will transition the DS2790 from SLEEP to Brown-Out to verify cell voltage before returning to CPU State. The DS2790 enters ANALOG State after a CPU STOP if any one of the following is active: the ADC, the protector, the interval timer or the watchdog timer. An external interrupt or an interrupt from any active internal circuit causes the DS2790 to transition back to CPU State to service the condition. If the DS2790 is in ANALOG or CPU State, and VDD falls below VBO, a brown-out condition occurs and the DS2790 enters the Brown-Out State. In Brown-Out State, the processor is halted without changing the instruction pointer. If VDD voltage rises above VBO within a time of tSU:OSCI, the DS2790 returns to CPU state and generates a brown-out interrupt (if enabled). Otherwise, if VDD remains below VBO for tSU:OSCI, the DS2790 enters an inactive state where it waits for a charger to be applied. When charge voltage is sensed on PLS, the DS2790 returns to the Brown-Out State where VDD voltage is verified before returning to CPU State.
Figure 3. DS2790 State Diagram
IC Inactive Brown-Out Timeout Charger Detect
VPLS > VIN + 0.15V t > tSU:OSCI
POR
Brown-Out Brown-Out
VDD < VBO
CPU and Protector Disabled.
External Interrupt
Brown-Out Recovery
VDD > VBO for tSU:OSCI
ANALOG Mode
ADC & Protector Active
Brown-Out Interrupt
VDD < VBO
SLEEP Mode
External Interrupts Monitored
CPU Mode CPU STOP
Analog Circuits Active
Code Execution
CPU STOP
Analog Circuits Inactive
14 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector
REGISTER SET
Most functions of the device are controlled by sets of registers. These registers provide a working space for memory operations as well as configuring and addressing peripheral registers on the device. Registers are divided into two major types: system registers and peripheral registers. The common register set, also known as the system registers, includes the ALU, accumulator registers, data pointers, interrupt vectors and control, and stack pointer. The peripheral registers define additional functionality that may be included by different products based on the MAXQ20 architecture. This functionality is broken up into discrete modules so that only the features required for a given product need to be included. Table 1 shows the DS2790 register set.
Table 1. System Register Map
REGISTER INDEX 00h 01h 02h 03h 04h 05h 06h 07h 08h 09h 0Ah 0Bh 0Ch 0Dh 0Eh 0Fh AP (8h) AP APC -- -- PSF IC IMR -- SC -- -- IIR -- -- CKCN WDCN A (9h) A[0] A[1] A[2] A[3] A[4] A[5] A[6] A[7] A[8] A[9] A[10] A[11] A[12] A[13] A[14] A[15] MODULE NAME (BASE SPECIFIER) PFX (Bh) IP (Ch) SP (Dh) PFX IP -- SP -- -- IV -- -- -- -- -- -- -- -- -- -- -- LC0 -- -- LC1 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- DPC (Eh) -- -- -- Offs DPC GR GRL BP GRS GRH GRXL FP -- -- -- -- DP (Fh) -- -- -- DP0 -- -- -- DP1 -- -- -- -- -- -- -- --
Note: Names that appear in italics indicate that all bits of a register are read-only. Names that appear in bold indicate that a register is 16 bits wide. Registers in module AP are bit addressable.
15 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector
Table 2. System Register Bit Functions
REGISTER REGISTER BIT NUMBER
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
AP APC PSF IC IMR SC IIR CKCN WDCN A[n] (0..15) PFX IP SP IV LC[0] LC[1] Offs DPC GR GRL BP GRS GRH GRXL FP DP[0] DP[1]
-- -- -- -- CLR IDS -- -- -- Z S -- GPF1 GPF0 -- -- CGDS -- -- -- -- IMS -- -- -- -- TAP -- -- -- -- IIS -- -- -- -- -- -- -- -- -- POR EWDI WDIF A[n] (16 bits) PFX (16 bits) IP (16 bits) -- -- -- -- -- -- -- -- -- -- -- -- IV (16 bits) LC[0] (16 bits) LC[1] (16 bits) Offs (8 bits) -- -- -- -- -- -- -- -- -- -- -- WBS2 WBS1 GR.15 GR.14 GR.13 GR.12 GR.11 GR.10 GR.9 GR.8 GR.7 GR.6 GR.5 GR.4 GR.3 GRL.7 GRL.6 GRL.5 GRL.4 GRL.3 BP (16 bits)
AP (4 bits) MOD2 MOD1 MOD0 OV C E -- INS IGE -- IM1 IM0 ROD PWL -- -- II1 II0 -- -- -- WTRF EWT RWT
SP (4 bits)
WBS0 SDPS1 SDPS0 GR.2 GR.1 GR.0 GRL.2 GRL.1 GRL.0
GRS.15 GRS.14 GRS.13 GRS.12 GRS.11 GRS.10 GRS.9 GRS.8 GRS.7 GRS.6 GRS.5 GRS.4 GRS.3 GRS.2 GRS.1 GRS.0
GRH.7 GRH.6 GRH.5 GRH.4 GRH.3 GRH.2 GRH.1 GRH.0
GRXL.15 GRXL.14 GRXL.13 GRXL.12 GRXL.11 GRXL.10 GRXL.9 GRXL.8 GRXL.7 GRXL.6 GRXL.5 GRXL.4 GRXL.3 GRXL.2 GRXL.1 GRXL.0
FP (16 bits) DP[0] (16 bits) DP[1] (16 bits)
16 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector
Table 3. System Register Bit Reset Values
REGISTER AP APC PSF IC IMR SC IIR CKCN WDCN A[n] (0..15) PFX IP SP IV LC[0] LC[1] Offs DPC GR GRL BP GRS GRH GRXL FP DP0 DP1 15 14 13 12 11 10 9 REGISTER BIT 8 7 0 0 1 0 0 0 0 0 s 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 0 0 0 0 0 0 0 s s 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 0 0 0 0 0 0 0 s 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 s 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Note: s indicates bit reflects pin state
17 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector
Table 4. Peripheral Register Map
REGISTER INDEX 00h 01h 02h 03h 04h 05h 06h 07h 08h 09h 0Ah 0Bh 0Ch 0Dh 0Eh 0Fh MODULE M0 (0h) PO PPU PAF EIC EINT PROT TC TCC PI -- -- -- -- -- -- -- M1 (1h) TWSINT TWSIM TWSCMD TWSCFG TWSTXD/RXD -- -- -- -- TWSFIF -- -- -- -- -- -- M2 (2h) -- -- -- -- -- -- -- -- -- -- -- -- -- ECNTL EADDR EDATA REGISTER INDEX 10h 11h 12h 13h 14h 15h 16h 17h 18h 19h 1Ah 1Bh 1Ch 1Dh 1Eh 1Fh MODULE M0 (0h) -- -- -- -- -- -- -- -- ICDT0 ICDT1 ICDC ICDF ICDB ICDA ICDD -- M1 (1h) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- M2 (2h) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Note: Names that appear in italics indicate that all bits of a register are read-only. Names that appear in bold indicate that a register is 16 bits. All locations are bit addressable.
18 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector
Table 5. Peripheral Register Bit Functions
REGISTER REGISTER BIT NUMBER
15
14
13
12
11
10
9
8
7
-- SDA_PU --
6
-- SCL_PU RSTD MTCI TCI -- TLOW.6 -- SCL ICDT0.6 ICDT1.6 -- -- ICDB.6 ICDA.6 ICDD.6
5
PO.5 PPU.5 PAF.5 PIP.1 -- -- TLOW.5 -- PI.5 ICDT0.5 ICDT1.5 REGE -- ICDB.5 ICDA.5 ICDD.5
4
PO.4 PPU.4 PAF.4 PIP.0 -- -- TLOW.4 -- PI.4 ICDT0.4 ICDT1.4 -- -- ICDB.4 ICDA.4 ICDD.4
3
PO.3 PPU.3 PAF.3 PIT.1 -- CE TLOW.3 -- PI.3 ICDT0.3 ICDT1.3 CMD.3 PSS.1 ICDB.3 ICDA.3 ICDD.3
2
PO.2 PPU.2 PAF.2 PIT.0
RST
1
PO.1 PPU.1 PAF.1 PIE.1 INT.1 PMM.1 TLOW.1 TTCK.0 PI.1 ICDT0.1 ICDT1.1 CMD.1 SPE ICDB.1 ICDA.1 ICDD.1
0
PO.0 PPU.0 PAF.0 PIE.0 INT.0 PMM.0 TLOW.0 TMOD PI.0 ICDT0.0 ICDT1.0 CMD.0 TXC ICDB.0 ICDA.0 ICDD.0
PO PPU PAF EIC EINT PROT TC TTC PI ICDT0 ICDT1 ICDC ICDF ICDB ICDA ICDD TWSINT TWSIM TWSCMD TWSCFG TWSTXD/RXD TWSFIF
MBOI BOI COCF THI.7
MSCI SCI DOCF THI.6
MSDI SDI SCF THI.5
MSNDI SNDI OVF THI.4
MCCI CCI UVF THI.3
MBEI BEI -- THI.2
MVI VI CC THI.1
MCI CI DC THI.0
MTI TI -- TLOW.7 -- SDA
DE TLOW.2 TTCK.1 PI.2 ICDT0.2 ICDT1.2 CMD.2 PSS.0 ICDB.2 ICDA.2 ICDD.2
ICDT0.15 ICDT1.15
ICDT0.14 ICDT1.14
ICDT0.13 ICDT1.13
ICDT0.12 ICDT1.12
ICDT0.11 ICDT1.11
ICDT0.10 ICDT1.10
ICDT0.9 ICDT1.9
ICDT0.8 ICDT1.8
ICDT0.7 ICDT1.7 DME -- ICDB.7
ICDA.15 ICDD.15 -- --
ICDA.14 ICDD.14 -- --
ICDA.13 ICDD.13 -- --
ICDA.12 ICDD.12 -- --
ICDA.11 ICDD.11 TIMEOUT TIMEOUT_ MASK
ICDA.10 ICDD.10 STOP STOP_ MASK
ICDA.9 ICDD.9
ICDA.8 ICDD.8
ICDA.7 ICDD.7 START
RESTART RESTART _READ _WRITE RESTART RESTART _READ _WRITE _MASK _MASK
ADDR.6
ADDR.5
ADDR.4
ADDR.3
ADDR.2
ADDR.1
ADDR.0
0
TXD_ TXD_ TXD_ RXD_ RXD_ RXD_ RXD_ BYTE EMPTY FULL CMD BYTE EMPTY FULL TXD_ TXD_ TXD_ RXD_ RXD_ RXD_ RXD_ START_ BYTE_ EMPTY_ FULL_ CMD_ BYTE_ EMPTY_ FULL_ MASK MASK MASK MASK MASK MASK MASK MASK TWSCMD TWSCMD TWSCMD TWSCMD TWSCMD TWSCMD TWSCMD TWSCMD .7 .6 .5 .4 .3 .2 .1 .0 TOUT_ CMD_HM_ 0 0 0 TLS_DIS TTO_DIS CMD_HM LONG DIS TXD/RXD TXD/RXD TXD/RXD TXD/RXD TXD/RXD TXD/RXD TXD/RXD TXD/RXD .7 .6 .5 .4 .3 .2 .1 .0 LTX.3 LTX.2 LTX.1 LTX.0 LRX.3 LRX.2 LRX.1 LRX.0
Note: Names that appear in italics indicate a read-only register bit.
19 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector
Table 6. Peripheral Register Reset Values
REGISTER REGISTER BIT NUMBER
15
14
13
12
11
10
9
8
7
0 0 0 0 0 0 0 0 s 0 0 0 0 0 0 0 0 0 0 0 0 0
6
0 0 0 0 0 0 0 0 s 0 0 0 0 0 0 0 0 0 0 0 0 0
5
1 0 0 0 0 0 0 0 s 0 0 0 0 0 0 0 0 0 0 0 0 0
4
1 0 0 0 0 0 0 0 s 0 0 0 0 0 0 0 0 0 0 0 0 0
3
1 0 0 0 0 0 0 0 s 0 0 0 0 0 0 0 0 0 0 0 0 0
2
1 1 1 0 0 0 0 0 s 0 0 0 0 0 0 0 0 0 0 0 0 0
1
1 0 0 0 0 0 0 0 s 0 0 0 0 0 0 0 0 0 0 0 0 0
0
1 0 0 0 0 0 0 0 s 0 0 0 0 0 0 0 0 0 0 0 0 0
PO PPU PAF EIC EINT PROT TC TTC PI ICDT0 ICDT1 ICDC ICDF ICDB ICDA ICDD TWSINT TWSIM TWSCMD TWSCFG TWSTXD/RXD TWSFIF
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 1
0 0 0 0 0
0 0 0 0 1
0 0 0 0 1
0 0 0 0 0
Note: s indicates bit reflects pin state.
20 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector
SYSTEM INTERRUPTS
Multiple interrupt sources are available for quick response to internal and external events. The MAXQ20 architecture uses a single interrupt vector (IV), single interrupt-service routine (ISR) design. For maximum flexibility, interrupts can be enabled globally, individually, or by module. When an interrupt condition occurs, its individual flag is set, even if the interrupt source is disabled at the local, module, or global level. Interrupt flags must be cleared within the firmware-interrupt routine to avoid repeated interrupts from the same source. Application software must ensure a delay between the write to the flag and the RETI instruction to allow time for the interrupt hardware to remove the internal interrupt condition. Asynchronous interrupt flags require a one-instruction delay and synchronous interrupt flags require a two-instruction delay. When an enabled interrupt is detected, execution jumps to a user-programmable interrupt vector location. The IV register defaults to 0000h on reset or power-up, so if it is not changed to a different address, application firmware must determine whether a jump to 0000h came from a reset or interrupt source. Once control has been transferred to the ISR, the interrupt identification register (IIR) can be used to determine if a system register or peripheral register was the source of the interrupt. The specified module can then be interrogated for the specific interrupt source and software can take appropriate action. Interrupts are evaluated by application code allowing the definition of a unique interrupt priority scheme for each application. Interrupt sources are available from the Watchdog timer described in the MAXQ users guide, the TWSINT Register described in the 2-Wire Interface section, and the EINT Register as shown in Figure 6.
EINT Register
The EINT Register contains interrupts generated by the ADC, the timer-counter, the protection circuits, the general purpose port pins and the serial-interface port pins. Their masks and their configuration bits, along with the RST pin status and control, are present in the EIC and PAF registers of module 0.
21 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector
Figure 6. EINT Register Interrupt Sources
GENERATOR INTERRUPT INT0 INT1 SCI DESCRIPTION The interrupt from pin P0.0 is configurable PAF.0/PIE.0 via the PAF.0, PIT.0 and PIP.0 bits. The interrupt from pin P0.1 is configurable PAF.1/PIE.1 via the PAF.1, PIT.1 and PIP.1 bits. MSCI MASK FREQUENCY Dependent on external conditions. Dependent on external conditions. Every time all lines are The serial connect interrupt is generated high after any of them when all serial lines become high. were low. Once every 220ms if all serial lines are held low. The serial disconnect interrupt is generated The first interrupt may take up to 440ms from the when all serial lines are low for at least time all lines go low. 220ms. Interrupt will not trigger if the ADC is off. The serial not disconnected interrupt is Every time any line goes high after all of them were generated when only one serial line goes low. high. Each time the charger The charger connection interrupt is detection condition generated when VPLS increases above VIN and evaluates to true after it creates a charger detection condition. was false. The brown-out interrupt indicates that VDD was below VBO in the past. It will not terminate Every time after exiting the microcontroller's stop mode. It will brown-out. interrupt the microcontroller, if MBOI is 1, after a charger brings VDD above VBO and causes the microcontroller to run. The battery event interrupt is an interrupt for a collection of events that initiate the various battery conditions that are handled by the protection logic: overvoltage, undervoltage, Each entry into a protection violation. charge overcurrent, discharge overcurrent and short-circuit. The battery conditions are available as flags in the MAS register of module 0. The voltage interrupt indicates the voltage Once every 6.9ms. Never register in the data peripheral memory block if the ADC is off. has a fresh voltage average. The current interrupt indicates that the quick average current register in the data peripheral Once every 88ms. Never if the ADC is off. memory block has a fresh reading and that the ACR has also been updated. The temperature interrupt indicates that the Once every 220ms. Never temperature register in the data peripheral if the ADC is off. memory block has a fresh average. The timer/counter interrupt indicates that Dependent on TMOD and the timer/counter has been reloaded after TTCK[1:0]. reaching its end-count.
Ports and Pins
SDI
MSDI
SNDI
MSNDI
CCI
MCCI
Brown-Out Detector
BOI
MBOI
Protection Logic
BEI
MBEI
VI
MVI
A/D Converter
CI
MCI
TI Timer/ Counter TCI
MTI MTCI
22 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector
I/O PORTS
The DS2790 includes a simple input/output (I/O) data port. From a software perspective, the port appears as a group of Special Function Registers within module M0. The simple I/O port defined for this product is described below: * * * * * CMOS input buffers Four open drain output drivers with selectable tri-state or weak pullups Two selectable open drain or push-pull output drivers with selectable tri-state Support alternate functions and TAP controller interface signals Two pins have interrupt capability
The port is accessed through five peripheral registers (PO, PI, PAF, PPU, and EIC) addressed either by byte or by individual bit locations. The I/O port is designed to provide programming flexibility for the application. All individual I/O pins are independently configured; and can be defined as an input, output, or alternate function. Table 7 summarizes the functionality of the I/O pins.
Table 7. I/O Port Pins
FUNCTIONS Primary P0.0 P0.1 P0.2 P0.3 P0.4 P0.5 SDA SCL Alternate INT0 INT1 RST* TAP
*
Bidirectional Configurable, [In] Configurable, [In] Configurable, [In] Configurable, [In] Configurable, [In] Configurable, [In] Yes Yes
TDI * TMS TCK TDO* *
*
CHARACTERISTICS Weak Passive Weak Active Pullup Strong Active Pullup Pulldown Configurable, [Off] Configurable, [Off] Configurable, [Off] Configurable, [Off] Configurable, [Off] Configurable, [Off] Configurable, [On] Configurable, [Off] Configurable, [On] Configurable, [Off] -
Note: Reset values are denoted with an * and by [].
PI register: The PI register is a read only input of the I/O pins. When the register is read, the logic level of each pin is reported in the corresponding bit locations. Reading a logic low or high on a pin does not change the output drive on that pin. PO register: The PO register controls the output state of the I/O pins. Data written to this register determines the pin output drive. When a bit is written to a "0" (cleared), the N-channel output drive transistor is enabled, and the pullup is disabled. When bit is written to a "1" (set), the N-channel output drive transistor is disabled, and the pullup enabled (if so configured). The PO bits are set asynchronously during power-on reset to disable the N-channel output drive. PO bits are not altered in SLEEP mode, however drive to the N-channel is disabled. PPU register: The PPU register contains independent bits that define each pin as hi-Z or pulled up when its Nchannel output drive transistor is disabled. P0.0 through P0.3 have weak pullups, P0.4 and P0.5 have strong pullups. When the output is disabled and the PPU bit is cleared, the pin is high impedance. When the output is disabled and the PPU bit is set, the pin's weak or strong pullup is enabled. When the PPU bit is set and the device enters STOP mode, the weak pullup remains enabled. PAF register: The PAF register enables or disables the alternate functions of P0.0-P0.2. When a pin's PAF bit is cleared, the pin is controlled by the PI, PO, PPU, and EIC registers. When the PAF bit is set, the pin operates in it's alternate function mode. The RST function of P0.2 can be disabled by writing the RSTD bit to 1. EIC register: The lower six bits of the EIC register are the Port Interrupt Control bits. The Port Interrupt Control bits are used to enable and configure detection of external interrupts. Interrupt enable bits, PIE.0 and PIE.1, enable detection of an interrupt on pins P0.0 and P0.1 respectively. Interrupt type bits, PIT.0 and PIT.1, define the type (level or edge) of interrupt on pins P0.0 and P0.1 respectively. Interrupt polarity bits, PIP.0 and PIP.1, determine the interrupt polarity on pins P0.0 and P0.1, respectively.
23 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector
Table 8. P0 Interrupt Configuration
PIE.x 0 1 1 1 1 PIT.x X 0 0 1 1 PIP.x X 0 1 0 1 RESULT Interrupt Disabled Interrupt Enabled, Triggered on Logic Low Interrupt Enabled, Triggered on Logic High Interrupt Enabled, Triggered on Falling Edge Interrupt Enabled, Triggered on Rising Edge
Figure 7. Port Pin Schematics
PPU.x PIE.x PIP.x PIT.x PAF.x INT.x PI.x
Interrupt Detect
PPU.2 RESET PAF.2 RSTD
P0.x
PI.2
P0.2
PO.x STOP PMM.0 PMM.1
PO.2 STOP PMM.0 PMM.1
Ports P0.0 and P0.1
Port P0.2
P0.3
PPU.x SDA/SCL PULL-UP
P0.4, P0.5
SDA/SCL IN
SDA/ SCL
PI.x
P0.x
SDA/SCL OUT
PO.x STOP PMM.0 PMM.1
SCL and SDA
Ports P0.3-P0.5
24 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector
PROGRAMMABLE TIMER/COUNTER
The Timer/Counter block operates as a simple 8-bit interval timer or counter. The start value is programmable and is automatically reloaded when a rollover occurs. The TMOD bit in the TCC register selects between the counter and timer modes. In the counter mode, external events on the P0.3 pin are counted. In the timer mode, OSCA clock source cycles are counted. The OSCA clock and brown-out detectors continue to run if the CPU is stopped.
Figure 8. Timer / Counter Block Diagram
P0.3
OSCA 14.3us 343us 6.86ms 220ms 2 1 TMOD 0
0
TLOW
7
Reload
0 TTCK[1:0]
THI
7 TCI INTERRUPT
The timer low byte (TLOW) is used to count input events, while the timer high byte (THI) is used to store the reload value. Firmware must initialize TLOW and THI with the same value for the first count to be the same as succeeding counts. TLOW counts up until FFh is reached, it is then automatically reloaded with the value in THI. THI remains unchanged unless modified by firmware. The clock source is selected with TTCK[1:0] bits. The following table describes the possible resolution and range of the timer.
Table 9. Programmable Timer Configuration
TMOD 1 1 1 1 0 TTCK[1:0] 00 01 10 11 N/A CLOCK PERIOD 14.3s 343s 6.86ms 220ms TIMER RANGE ( t * 2 ) 3.66ms 87.9ms 1.76s 56.3s Counter Mode
8
2-WIRE SLAVE PERIPHERAL INTERFACE MODULE
A 2-wire serial-peripheral interface for interconnection with external devices is incorporated into the DS2790. The 2 2-Wire Slave (TWS) peripheral allows interrupt driven I C or SMBus device communication with a minimal amount of CPU overhead. A Transmit/Recieve Data register (TWSTXD/RXD) handles byte level data transfers and the TWS FIFO register (TWSFIF) monitors the usage of the transmit and receive buffers. The 2-Wire Slave Command register (TWSCMD) maintains the command byte of every communication sequence for use by the MAXQ20 core. Configuration of the 2-wire interface is handled through the TWS Configuration register (TWSCFG) allowing system software to change the DS2790's slave address, control handshaking on the clock line, and control bus timeout settings. The asynchronous interface between the TWS and MAXQ20 core is handled by TWS generated interrupts reported in the Interrupt register (TWSINT) and controlled in Interrupt Mask Register (TWSIM).
25 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector
Figure 9. 2-Wire Slave Configuration Register (TWSCFG)
FIELD ADDR reserved BIT 15:9 8:5 FORMAT R/W R ALLOWABLE VALUES 2-Wire Slave Address. Default = 0001011b Reserved bits read as 0000b Lengthen Timeouts. Only valid if TTIMEOUT or TLOW:SEXT timout is enabled. 0 = TLOW:SEXT - Nominal 15ms TTIMEOUT - Nominal 30ms 1 = TLOW:SEXT - Nominal 60ms TTIMEOUT - Nominal 120ms TLOW:SEXT Disable 0 = TLOW:SEXT timeout is enabled 1 = TLOW:SEXT timeout is disabled TTIMEOUT Disable 0 = TTIMEOUT is enabled 1 = TTIMEOUT is disabled Only valid if CMD_HS_DIS = 0. 0 = (CE) Clock Extend until command register release latch is cleared or clock extend timeout. 1 = (NACK) Nack the command byte if command register release latch is clear. Command Handshake Mode Disable. 0 = Command Handshake Mode is enabled. 1 = Command unconditionally accepted.
TOUT_LONG
4
R/W
TLS_DIS TTO_DIS
3 2
R/W R/W
CMD_HM
1
R/W
CMD_HM_DIS
0
R/W
Note: The peripheral handles clock extension and Ack/Nack generation without intervention from the MAXQ20 core. Bus timeout conditions detailed in the 2-Wire Specification, TTIMEOUT and TLOW:SEXT, are also handled directly by the TWS hardware.
Command Register and Handshaking
During a write, the first byte after the slave address is the command byte. The command byte signifies how the data following the command byte should be interpreted. It is useful for software to have access to this command byte during the entire 2-wire transaction. Therefore, the command byte is stored in the Command Register (TWSCMD) and handshaking between the 2-wire master and CPU is implemented to ensure that the command byte has been processed by the CPU before a new command byte can be received. Handshaking is configured in the 2-wire Configuration Register (TWSCFG); and the following handshaking modes can be implemented: * * CMD_HM_DIS=1, CMD_HM=X Handshaking disabled. All new command bytes are unconditionally written to the TWSCMD register and acknowledged (ACK) by the 2-wire hardware. CMD_HM_DIS=0, CMD_HM=0 Upon receipt of a new command byte, the TWSCMD register becomes "busy". The TWSCMD register will remain busy and can not accept a new command byte until the CPU executes a "dummy" write to the TWSCMD register. The dummy write clears the busy state of the TWSCMD register so that it can accept a new command byte. If the master attempts to send additional command bytes while the TWSCMD register is busy, the 2-wire hardware will begin clock extending; which will continue until the CPU executes a dummy write to the TWSCMD register or the SMBus timeout limits are reached (if enabled). CMD_HM_DIS=0, CMD_HM=1 In this mode, If the master attempts to send additional command bytes while the TWSCMD register is busy, the 2-wire hardware will not acknowledge (Nack) the command byte. The master can re-attempt to send the command byte until it is Ack'ed.
*
26 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector
2-Wire Slave Interrupts
An interrupt is generated when any condition that sets an interrupt status register bit occurs, and the corresponding interrupt mask bit in the 2-Wire Slave Interrupt Mask Register (TWSIM) is also set. All 2-wire interrupts are maskable by clearing the corresponding bit in the TWSIM. Upon system reset, all 2-wire interrupt mask bits are cleared automatically. The interrupt status register is 2 bytes in length and is readable and writeable by the MAXQ20 core. Like the high level interrupt status register in the core, when the TWSINT register is read, the state of the interrupt status bits are returned but not altered. Edge triggered interrupt status bits are cleared by writing a `0' to their location. Any attempt to write a `1' is ignored. Level triggered interrupt status bits are cleared automatically after the event that caused the interrupt to occur has ended.
Table 10. 2-Wire Slave Interrupt Sources
INTERRUPT (TWSINT)
RXD_FULL RXD_EMPTY RXD_BYTE RXD_CMD TXD_FULL TXD_EMPTY TXD_BYTE
MASK (TWSIM)
RXD_FULL_MASK RXD_EMPTY _MASK RXD_BYTE_MASK RXD_CMD_MASK TXD_FULL_MASK TXD_EMPTY _MASK TXD_BYTE_MASK
DESCRIPTION When the RXD FIFO is full. RXD buffer is empty. Byte moved from the incoming shift register to the RXD FIFO. Command byte receive completed. TXD buffer is full. When the TXD FIFO is empty. Byte moved from TXD FIFO to the outgoing shift register. A start followed by the address defined in the configuration register was recognized. (This bit is not set during a repeated start condition.) A repeated start followed by the address defined in the configuration register was received with the read/write bit clear. A repeated start followed by the address defined in the configuration register was received with the read/write bit set. After an address qualified Start or Restart, a STOP is recognized on the bus. TTIMEOUT or TLOW:SEXT event recognized on the bus. Either timeout event will reset the TWS interface.
TRIGGER Level Edge Edge Edge Edge Level Edge Edge Edge Edge Edge Edge
START RESTART _WRITE RESTART _READ STOP TIMEOUT
START_MASK RESTART_WRITE _MASK RESTART_READ _MASK STOP_MASK TIMEOUT_MASK
Transmit and Receive Data Buffers
Since multiple data bytes can be associated with a single command byte, the TWS is designed with transmit and receive buffers to prevent data loss and reduce CPU overhead during a communication sequence. Data received from the master is directed to an 8 byte deep receive first in, first out buffer (RXD FIFO) until read by the CPU. Data to be transmitted by the DS2790 is stored in a separate 8-byte transmit FIFO buffer (TXD FIFO) until the master reads it. If the RXD FIFO buffer becomes completely full or the TXD FIFO buffer becomes completely empty during communication, the interface will begin clock extending the bus to maintain data integrity. The CPU has access to the TXD and RXD FIFOs through the Transmit/Receive Data register (TWSTXD/RXD). During a master read (TWS transmit) data is pushed onto the TXD FIFO by writing to the TWSTXD/RXD register. Likewise, during a master write (TWS receive), the CPU can pull data off the RXD FIFO by reading the TWSTXD/RXD register.
27 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector Both the TXD and RXD FIFOs are flushed when a new command byte is accepted (command handshaking is enabled and the TWSCMD register is not busy, or when command handshaking is disabled). In the TWS FIFO register (TWSFIF), LRX[3:0] reports the number of received bytes waiting in the RXD FIFO and LTX[3:0] reports the number of bytes in the TXD FIFO to be transmitted.
Timeouts and Clock Extending
Clock extending during a DS2790 receive event (master write), is applied to delay the rising edge of SCL just before the ACK symbols after the command byte is sent, and to any ACK symbols thereafter. If the RXD FIFO is full, the clock low time just prior to the ACK symbol will be extended until a timeout occurs or the RXD FIFO has been read and is no longer full. Clock extending during a DS2790 transmit event (master read), is applied to delay the rising edge of SCL just after the ACK symbol following the address, and to any ACK symbols thereafter. If the TXD FIFO is empty, the clock low time just after the ACK symbol will be extended until a timeout occurs of the TXD FIFO has been written and is no longer empty. The TTIMEOUT and TLOW:SEXT timers analyze the 2-Wire bus for timeout conditions, and can cause the TWS to reset its internal state machine. These timers allow the bus to remain available even after bus fault conditions such as device hot swapping. Without the timers, such scenarios could result in a bus lock-up preventing all further communication. The TTIMEOUT timer begins counting on the falling edge of clock, and is reset on the rising edge of clock. If the timer ever reaches the TTIMEOUT value (nominal 30ms), the clock line is released, after a short delay the data line is also released. The TLOW:SEXT timer is reset whenever a START condition occurs on the bus. Specifically note that the timer is not reset during a REPEATED START condition. The timer counts while the TWS is holding the clock low. The timer does not count when a master or other slave device is holding the clock low. The timer is stopped on a STOP condition. If the timer times out (nominal 15ms), the clock line is released, followed by the data line. The TTIMEOUT timer can be disabled using the TTO_DIS bit in the TWSCFG register, while TLOW:SEXT can be disabled using the TLS_DIS bit. The TOUT_LONG bit in the TWSCFG register allows the nominal value of the timeout conditions to be increased by a factor of four.
Command Codes
The DS2790 has two reserved command codes: a software power on reset (POR) of the IC, and an instruction to begin program loading over the 2-wire interface. Each command code is first enabled by transmitting the Command Enable (FEh) followed directly by the command instruction. There are no associated data bytes with either command. Any 2-wire communication between the two instructions negates the operation. See the MAXQ Family User's Guide: DS2790 Supplement for the 2-wire programming procedure. These command codes are fixed inside the DS2970 and cannot be altered. System firmware should avoid using FEh as a command code during during device operation.
Table 11. 2-Wire Interface Command Codes
COMMAND Command Enable Soft POR Request Programming available HEX CODE FEh Repeated FEh FDh 00h-FCh, FFh Causes a reset of the part. Initiates programming over 2-wire interface. Defined by application firmware. PURPOSE Enable soft POR or program command.
28 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector
Figure 10. 2-Wire Communication Examples
I C/SMBus Write Data Sequence
S Slave Address Wr Ack Command Ack Byte Data Byte 1 Data Byte Data Byte Ack ... Ack Ack 8 9 P 2
Potential Clock Extension if Cmd Release Latch Clear, CMD_HM_DIS = 0, and CMD_HM = 0
Potential Clock Extension when RXD is full.
I2C/SMBus Read Data Sequence
S Slave Address Wr Ack Command Data Byte Data Byte Ack Ack ... Ack Byte 1 n
S
Slave Address
Data Byte Data Byte Ack Rd Ack 1 2
Nack
P
Potential Clock Extension if Cmd Release Latch Clear, CMD_HM_DIS = 0, and CMD_HM = 0
Potential Clock Extension when TXD is empty.
DS2790 Software POR Sequence
S Slave Address Wr Ack FEh Ack P S Slave Address Wr Ack FEh Ack P
Command Enable
Repeated FEh Generates Software POR
DS2790 2-Wire Programming Request
S Slave Address Wr Ack FEh Ack P S Slave Address Wr Ack FDh Ack P 2-Wire Programming Sequence Begins
...
Command Enable
Initiate Programming over the 2-Wire Interface
Master to Slave Slave to Master
29 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector
ANALOG-TO-DIGITAL CONVERSION
The DS2790 performs real-time measurements of system temperature, voltage, current, and accumulated current. The DS2790's analog-to-digital converter is controlled by an internal state machine that sequences the measurements, and stores the results in memory. The conversion results of the ADC are mapped into data memory starting at word address 6003h, as shown in table 12. Programs should read a measurement value as a word to ensure that the value does not change between instructions. The DS2790 current measurement system is designed to provide timely data on charge and discharge current at a moderate resolution level while simultaneously accumulating high resolution average data to support accurate coulomb counting. Current is measured by sampling the voltage drop across a series sense resistor, RSNS, connected between SNS1 and SNS2. Individual current samples are taken every 1/fSAMP (687s). All samples are averaged to report Current, Average Current, and Accumulated Current values. The DS2790 measures voltage as a difference between the VIN pin and analog ground pin AVSS. Individual voltage samples are taken approximately every 1/fSAMP (687s). Multiple samples are averaged to update the Average Voltage register. The DS2790 measures temperature directly on chip. Individual temperature samples are taken every 10/fSAMP (6.87ms). Multiple samples are averaged to update the Average Temperature register.
Table 22. ADC Related Registers
WORD ADDRESS 6003h 6004h 6005h 6006h 6007h 6008h 6009h 600Ah ACCESS Read Only Read Only Read Only R/W Read Only Read Only Read Only R/W DESCRIPTION Voltage Register Current Register Temperature Register Accumulated Current Register Accumulated Current (Middle Word) Accumulated Current (Lower Word) Average Current Register ADC Configuration Register
Current Measurement
The voltage signal developed across the sense resistor (between SNS1 and SNS2) is differentially sampled by the ADC inputs via internal 10k resistors connected between SNS1 and IS1, and SNS2 and IS2. Isolating the ADC inputs (IS1 and IS2 pins) from the sense resistor with 10k facilitates the use of an RC filter by adding a single external capacitor. The RC filter extends the effective input range beyond 64mV in pulse-load or pulse-charge applications. The ADC accurately measures large peak signals as long as the differential signal level at IS1 and IS2 does not exceed 64mV. The Current register reports the average of 128 individual current samples every 88ms. The reported value represents the average current during the 88ms measurement period. The Average Current register reports the average of 4096 current samples and is updated every 2.8s. Figures 11 and 12 specify the update interval and units for the Current and Average Current registers. Values are posted in two's compliment format. Positive values represent charge currents (VIS1 > VIS2) and negative values represent discharge currents (VIS2 > VIS1). Positive currents above the maximum register value are reported at the maximum value, 7FFFh. Negative currents below the minimum register value are reported at the minimum value, 8000h.
30 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector
Figure 11. Current Register Format
12-bit + sign resolution (13-bit), 88ms update interval
Word Address 6004h S MSb
"S": sign bit(s)
211 210 29
28
27
26
25
24
23
22
21
20
X
X
X LSb
Units: 20 = 15.625mV/Rsns
Figure 12. Average Current Register Format
15-bit + sign resolution (16-bit), 2.8s update interval
Word Address 6009h S MSb
"S": sign bit(s)
214 213 212 211 210 29
28
27
26
25
24
23
22
21
20 LSb
Units: 20 = 1.953mV/Rsns
Current Offset Correction
Continuous offset cancellation is performed automatically to correct for offsets in the current measurement system. Individual values reported by the Current register have a maximum offset of 0.5 bits (7.8125V). Individual values reported in the Average Current register have a maximum offset of 4 bits (7.8125V).
Current Accumulation
The DS2790 measures current for coulomb-counting purposes, with an accuracy of 2% 3.9V over a range of 64mV. Using a 15m sense resistor, current accumulation is performed over a range of 4.26A while measuring standby currents with an accuracy of 195A. Current measurements are internally summed, or accumulated, with the results displayed in the Accumulated Current Register (ACR). The accuracy of the ACR is dependent on both the current measurement and the accumulation timebase. The 16-bit ACR has a range of 204.8mVh with a resolution of 6.25Vh. Accumulation of charge current above the maximum register value is reported at the maximum value; conversely, accumulation of discharge current below the minimum register value is reported at the minimum value. Read and write access is allowed to the ACR.
Figure 13. Accumulated Current Register Format Word Address 6006h S MSb
"S": sign bit(s)
-1 -32
214 213 212 211 210 29
28
27
26
25
24
23
22
21
20 LSb
Units: 20 = 6.25mVh/Rsns
The lower 32 bits of ACR resolution ( bits 2 to 2 ) can be read by firmware from address locations 6007h and 6008h respectively. Note that since the lower bits are from separate address words it cannot be guaranteed that they will contain data from the same measurement as the main ACR register at the time of reading. However, two consecutive reads from addresses 6006h-6008h that contain the same data esures that all data is from the same measurement. When the ACR register is written, the lower ACR bits are automatically cleared.
31 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector
Accumulation Blanking
In order to avoid the accumulation of small positive offset errors over long periods, an offset blanking filter is provided. The blanking filter is enabled by setting the OBEN bit in the ADC Configuration Register. When OBEN is set, charge currents (positive values from the Current register) less than 62.5mV are not accumulated in the ACR. The minimum charge current accumulated in the ACR is 4.167mA for RSNS = 0.015W.
Accumulation Bias
Systematic errors or an application preference can require the application of an arbitrary bias to the current accumulation process. The Accumulation Bias value sets a user programmed positive or negative bias to the current accumulation process. The accumulation bias value can be used to estimate battery currents that do not flow through the sense resistor, estimate battery self-discharge, or correct for offset error accumulated in the ACR register. The user programmed two's compliment value is added to the ACR once per current sample. The bias control is applied in 0.98mV increments over a 125mV range. When using a 15mW sense resistor, the bias control can be adjusted in 65.3mA increments over a 8.33mA range. The Accumulation Bias bit field is located in the upper byte of the ADC Configuration register.
Figure 14. Accumulation Bias Field Upper Byte of Word Address 600Ah S MSb
"S": sign bit
0
26
25
24
23
22
21
20 LSb
Units: 2 = 0.98mV/Rsns
Voltage Measurement
The DS2790 continually measures the voltage between pins VIN and AVSS over a 0.0V to VFS range, and the Voltage register is updated in two's-complement format every 3.4ms with a resolution of 4.88mV. Voltages above the maximum register value are reported as the maximum value.
Figure 15. Voltage Register Format Word Address 6003h S MSb
"S": sign bit
0
29
28
27
26
25
24
23
22
21
20
X
X
X
X
X LSb
Units: 2 = 4.88 mV
Temperature Measurement
The DS2790 uses an integrated temperature sensor to continually measure battery temperature. Temperature measurements are updated in the Temperature register every 220ms in two's-complement format with a resolution of 0.125C over a 127C range. The Temperature register format is shown in Figure 16.
32 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector
Figure 16. Temperature Register Format Word Address 6005h S MSb
"S": sign bit
29
28
27
26
25
24
23
22
21
20
X
X
X
X
X LSb
Units: 20 = 0.125C
ADC Configuration Register
The ADC Configuration register located at word address 600Ah controls current measurement bias and offset blanking as well as current fault limits for the protector circuitry. ADC Configuration register bits are read and write accessable by application code. COCT, DOCT, and SCDT bit functionality is described under Lithium-Ion Protection.
Figure 17. ADC Configuration Register Format
ADDRESS Field IBIAS 600AH Bit 15:8 Format R/W BIT DEFINITION Allowable Values Accumulation Register Bias 8-bit 2's complement value that is added to the ACR on every update. Charge Overcurrent Threshold3/4See Lithium-Ion Protection. See VOC in the specification table for limit tolerances. 0 0 = 16mV VOC 0 1 = 32mV VOC 1 0 = 48mV VOC 1 1 = 64mV VOC Discharge Overcurrent and Short Circuit Thresholds3/4See Lithium-Ion Protection. See VOC and VSC in the specification table for limit tolerances. 0 0 = 16mV VOC, 100mV VSC 0 1 = 32mV VOC, 140mV VSC 1 0 = 48mV VOC, 180mV VSC 1 1 = 64mV VOC, 220mV VSC Short Circuit Delay Time3/4See Lithium-Ion Protection. See tSCD in the specification table for limit tolerances. 0 = 250s 1 = 2.0ms Undefined Offset Blanking Enable 0 = All current measurements accumulated into the ACR. 1 = Positive current measurements less than 62.5V/RSNS not accumulated into the ACR.
COCT
7:6
R/W
DOCT
5:4
R/W
SCDT Reserved OBEN
3 2:1 0
R/W Read Only R/W
33 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector
LITHIUM-ION PROTECTION
For safety, lithium-Ion cell protection functions are handled by a completely independent state machine. Application firmware can disable the protection FETs, but is not able to override the protector and enable the FETs. During active operation (CPU or Analog mode), the DS2790 constantly monitors cell voltage and current to protect the battery from overcharge (overvoltage), overdischarge (undervoltage), excessive charge and discharge currents (overcurrent, short circuit), and extreme temperatures (overtemperature, undertemperature). Protection conditions and DS2790 responses are described in the following sections and summarized in Table 13 and Figure 18.
Table 13. Lithium-Ion Protection Conditions and DS2790 Responses
CONDITION Overvoltage Undervoltage Overcurrent, Charge Overcurrent, Discharge Short Circuit Charge Overtemperature Charge Undertemperature Discharge Overtemperature Discharge Undertemperature ACTIVATION THRESHOLD VIN > VOV VIN < VUV VIS > VOC VIS < -VOC VIS > VSC TA > TCH TA TCL TA > TDH TA TDL
(4)
DELAY tOVD tUVD tOCD tOCD tSCD
RESPONSE CC Low CC Low, DC Low CC Low, DC Low DC Low DC Low CC Low CC Low DC Low DC Low
RELEASE THRESHOLD VIN < VCE, or VIS -2mV (1) VPLS > VIN + 0.15V (charger connected) VPLS < VDD - VTP VPLS > VDD - VTP VPLS > VDD - VTP TA TCH TA > TCL TA TDH TA > TDL
(4) (2)
(3)
(3)
(4)
(4)
(4)
(4)
(4)
(4)
VIS = VIS1 - VIS2. Off = VPLS for CC and VDD for DC.. All voltages are with respect to VSS. ISNS references current delivered from pin SNS. Under-/Overtemp conditions have no activation delay from the time the Temperature register updates. The temperature register result is an average over 220ms, this provides protection against the MOSFETs oscillating. Note 1: Note 2: Note 3: Note 4: If VIN < VUV, release is delayed until the recovery charge current (IRC) charges the battery and allows VIN to exceed VUV. With test current ITST flowing from PLS to VSS (pulldown on PLS). With test current ITST flowing from VDD to PLS (pullup on PLS). Temperature faults must be enabled through the TLIME bit in password protected trim memory. Temperature fault thresholds are determined by the state of TLIM[1:0]. See Password Protected User Trim.
Overvoltage, OV. If the cell voltage on VIN exceeds the overvoltage threshold, VOV, for a period longer than overvoltage delay, tOVD, the DS2790 shuts off the external charge FET and sets the OVF bit in the protection register. When the cell voltage falls below charge enable threshold VCE, the DS2790 re-enables the charge FET (unless another protection condition prevents it). Discharging remains enabled during overvoltage, and the DS2790 re-enables the charge FET before VIN < VCE if a discharge current of VIS -2mV is detected. Undervoltage, UV. If the voltage of the cell drops below undervoltage threshold, VUV, for a period longer than undervoltage delay, tUVD, the DS2790 shuts off the charge and discharge FETs and sets the UVF bit in the protection register. The DS2790 provides a current-limited (IRC) recovery charge path from PLS to VDD to gently charge severely depleted cells. The recovery path is enabled when 0 VIN < VCE. Once VIN exceeds VUV the DS2790 returns to normal operation. Charge Overcurrent, COC. The voltage difference between the IS1 pin and the IS2 pin (VIS = VIS1 - VIS2) is the filtered voltage drop across the current-sense resistor. If VIS exceeds overcurrent threshold VOC for a period longer than overcurrent delay tOCD, the DS2790 shuts off both external FETs and sets the COCF bit in the protection register. The charge current path is not re-established until the voltage on the PLS pin drops below VDD - VTP. The DS2790 provides a test current of value ITST from PLS to VSS to pull PLS down to detect the removal of the offending charge current source. The Charge VOC limit is programmable through the COCT bits in the ADC Configuration register. 34 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector Discharge Overcurrent, DOC. If VIS is less than -VOC for a period longer than tOCD, the DS2790 shuts off the external discharge FET and sets the DOCF bit in the protection register. The discharge current path is not reestablished until the voltage on PLS rises above VDD - VTP. The DS2790 provides a test current of value ITST from VDD to PLS to pull PLS up to detect the removal of the offending low-impedance load. The Discharge VOC limit is programmable through the DOCT bits of the ADC Configuration register. Short Circuit, SC. If the voltage on the SNS2 pin with respect to SNS1 exceeds short-circuit threshold VSC1 for a period longer than short-circuit delay tSCD, the DS2790 shuts off the external discharge FET and sets the SCF bit in the protection register. The discharge current path is not re-established until the voltage on PLS rises above VDD VTP. The DS2790 provides a test current of value ITST from VDD to PLS to pull PLS up to detect the removal of the short circuit. The VSC limit is programmable through the DOCT bits of the ADC Configuration register. The tSCD limit is programmable through the SCDT bit of the ADC Configuration register. If a short circuit event collapses VDD, a secondary short circuit protection function disables the discharge FET within a period of tSSCD. Charge/Discharge Over-/Undertemperature, DOT, DUT. Assuming no other fault conditions, the CC pin is enabled when the temperature is greather than TCH, or less than or equal to TCL. The DC pin is disabled when the temperature is greater than TDH, or less than or equal to TDL. When the temperature is inside these ranges, both control pins are enable. There is no hysteresis or delay period associated with temperature protection. Temperature protection must be enabled by user code by setting the TLIME bit. Over-/Undertemperature limits are defined by TLIM0 and TLIM1 bits located in password protected memory.
Figure 18. Lithium-Ion Protection Circuitry Example Waveforms
VCELL CHARGE VIS DISCHARGE
(NOTE 1)
VOV VCE VUV VOC 0 -VOC -VSC tOCD VCP VDD tUVD VCP VPLS
CC
tOVD
tOVD
DC UVF
tSCD
tOCD
NOTE 1: TO ALLOW THE DEVICE TO REACT QUICKLY TO SHORT CIRCUITS, DETECTION OCCURS ON THE SNS PIN RATHER THAN ON THE FILTERED IS1 AND IS2 PINS. THE ACTUAL SHORT-CIRCUIT DETECT CONDITION IS VSNS2 - VSNS1 > VSC1.
Summary. All of the protection conditions described above are AND'ed together with temperature protection functions to affect the CC and DC outputs. DC = (Undervoltage) and (Overcurrent, Either Direction) and (Short Circuit) and (Discharge Overtemperature if enabled) and (Discharge Undertemperature if enabled) and (DE = 1) and SLEEP CC = (Overvoltage) and (Undervoltage) and (Overcurrent, Charge Direction) and (Charge Overtemperature if enabled) and (Charge Undertemperature if enabled) and (CE = 1) and SLEEP
35 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector
Protection Register
The Protection Register allows system software to determine if a protection fault condition has occurred and what triggered the protection fault. When a protection fault occurs, its corresponding protection flag is set. The flag will remain set until system software clears the bit after the fault is no longer present. System software can also disable charging or discharging by clearing the charge enable or discharge enable bits, or system software can completely disable the ADC and/or the protection FETs using the PMM bits. There is no way for system software to override a fault condition and enable the FETs.
Figure 19. Protection Register Format (PROT)
FIELD COCF DOCF SCF OVF UVF Reserved CC DC Reserved CE BIT 15 14 13 12 11 10 9 8 7:4 3 FORMAT R/W R/W R/W R/W R/W Read Only Read Only Read Only Read Only R/W DEFINITION Charge Overcurrent Flag. Set to 1 by an COC fault condition. Can only be reset by system software after fault is corrected. Discharge Overcurrent Flag. Set to 1 by a DOC fault condition. Can only be reset by system software after fault is corrected. Short Circuit Flag. Set to 1 by a SC fault condition. Can only be reset by system software after fault is corrected. Overvoltage Flag. Set to 1 by an OV fault condition. Can only be reset by system software after fault is corrected. Undervoltage Flag. Set to 1 by a UV fault condition. Can only be reset by system software after fault is corrected. Undefined CC Pin Mirror. This bit mirrors the state of the CC pin. DC Pin Mirror. This bit mirrors the state of the DC pin. Undefined Charge Enable. 0 = Charge FET is disabled. 1 = Charge FET is enabled unless disabled by fault. Writing this bit to 1 will not override a fault condition. Discharge Enable. 0 = Discharge FET is disabled. 1 = Discharge FET is enabled unless disabled by fault. Writing this bit to 1 will not override a fault condition. Protection and Measurement Modes. 0 0 = ADC disabled, CC and DC low. 0 1 = ADC enabled, CC and DC low. 1 0 = ADC enabled, CC and DC low. 1 1 = ADC enabled, CC and DC high.
DE
2
R/W
PMM
1:0
R/W
Adjusting Protection Thresholds
The protection thresholds are set in two locations. The Charge Overcurrent threshold, Discharge Overcurrent threshold, Short-Circuit Current threshold, and Short-Circuit Delay thresholds are set in the ADC Configuration Register location 600Ah. Values for Overvoltage, Undervoltage, and all temperature thresholds are stored in the password protected memory. See the Password Protected User Trim section.
High Side N-Channel Protection FETs
The DS2790 controls charging and discharging through external high-side N-FETs controlled through the CC and DC pins. An internal charge pump generates the voltage needed to drive the external FETs. An external capacitor connected between the CP and VSS pins stores the charge needed for the DS2790 to maintain the CC and DC outputs. To disable discharging, the DS2790 internally connects DC to VSS. To disable charging, the DS2790 internally connects CC to VDD. To enable charging or discharging, the DS2790 drives the appropriate FET gate to VOCP by internally pulling CC and DC up to the CP voltage. The system designer should consider the following when selecting external FETs:
36 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector * * Gate to Source voltage. The external FETs must be able to withstand a voltage between their gate and source pins of at least the charge pump voltage VOCP to prevent damage. Gate leakage. The gate leakage of both external FETs must be smaller than 0.9A to ensure CC and DC meet the VOCP specification.
PASSWORD PROTECTED USER TRIM
System software has the ability to change Temperature and Voltage protection levels, 2-wire slave address, and current measurement gain of the IC through the User Trim in Program EEPROM (Word Addresses 001Dh-001Fh). The user trim values are enabled through the Trim Key in the lower byte of address 001Dh. If the Trim Key is set to 76h, the user trim values replace the default trim values, if the Trim Key is set to any other value, default trim is selected. Note that either all user trim values are enabled or none are enabled. Figure 20. shows the format of all values that can be adjusted and their default trim values.
Figure 20. User Trim Registers
ADDRESS Field Unused Slave Address Trim Key 001Dh Bit 15 14:8 Format R/W R/W BIT DEFINITION Allowable Values Undefined3/4General purpose 2-Wire Slave Address Valid only if Trim Key = 76h Default = 0001011b Trim Key Enables or disables all other user trim values. 76h = All User Trim values valid. Other = All User Trim values invalid. Default trim used. BIT DEFINITION Allowable Values Current Gain Trim These bits adjust the current gain by +/-25%. The most significant bit is the 2's compliment sign bit, 1LSB = 0.195%. IG 15:8 R/W Example: A4h (-92d) adjusts the trim by -17.94%. Valid only if Trim Key = 76h Default = Factory trim value Sense Resistor Temperature Coefficient These bits adjust the current gain based on temperature of the sense resistor. 1LSB = 30.5ppm/C. SRTC 7:0 R/W Example: 1Ah (26d) adjusts current measurements for a sense resistor with a 793ppm/C temperature coefficient. Valid only if Trim Key = 76h Default = 00h
7:0
R/W
ADDRESS Field
001Eh Bit
Format
37 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector
Address Field Unused UVT
001Fh Bit 15:13 12:8
Format R/W R/W
Bit Definition Allowable Values Undefined - General purpose Undervoltage Threshold The Undervoltage threshold ranges from 2.30V to 2.90V and is calculated by the equation: VUV = 2.90V - 0.0195V x UVT[4:0] Valid only if Trim Key = 76h Default = 17h (2.45V) Temperature Limit Enable 0 = Disables Lithium-Ion protection based on temperature. 1 = Enables temperature protection defined by TLIM[1:0] bits. Valid only if Trim Key = 76h Default = 0 Temperature Limit Thresholds 00= 01= 10= 11= TCL -3C -3C -23C -43C TCH 53C 58C 73C 88C TDL -23C -23C -23C -43C TDH 63C 68C 73C 88C
TLIME
7
R/W
TLIM
6:5
R/W
OVT
4:0
R/W
Valid only if Trim Key = 76h and TLIME = 1 Default = 0 0 Overvoltage Threshold The Overvoltage threshold ranges from 4.25V to 4.55V and is calculated by the equation: VOV = 4.25V + 0.00977V x OVT[4:0] The enable threshold VCE is always fixed at 0.1V below VOV. Valid only if Trim Key = 76h Default = 0Ah (4.35V)
38 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector
IN-CIRCUIT DEBUG
Embedded debugging capability is available through the JTAG-compatible Test Access Port. Embedded debug hardware and embedded ROM firmware provide in-circuit debugging capability to the user application, eliminating the need for an expensive in-circuit emulator. Figure 21 shows a block diagram of the in-circuit debugger. The incircuit debug features include: * * * a hardware debug engine, a set of registers able to set breakpoints on register, code, or data accesses (ICDA, ICDB, ICDC, ICDD, ICDF, ICDT0, and ICDT1) a set of debug service routines stored in the utility ROM.
Figure 21. In-Circuit Debugger
UTILITY ROM DEBUG SERVICE ROUTINES DEBUG ENGINE CPU
TMS TCK TDI TDO
CONTROL
TAP CONTROLLER
BREAKPOINT ADDRESS DATA
The embedded hardware debug engine is an independent hardware block in the microcontroller. The debug engine can monitor internal activities and interact with selected internal registers while the CPU is executing user code. Collectively, the hardware and software features allow two basic modes of in-circuit debugging: * * Background mode allows the host to configure and set up the in-circuit debugger while the CPU continues to execute the application software at full speed. Debug mode can be invoked from background mode. Debug mode allows the debug engine to take control of the CPU, providing read/write access to internal registers and memory, and single step trace operation.
39 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector
APPLICATIONS
The low-power, high-performance RISC architecture of the DS2790 makes it an excellent fit for many portable or battery-powered applications that require cost-effective computing and analog measurement capability. The highthroughput core is programmable in-circuit over the 2-wire and JTAG interfaces, allowing for firmware upgrades, and ease of code development. Applications benefit from a wide range of peripheral interfaces, allowing the microcontroller to communicate with many external devices. With an integrated charge pump, high side N-FET drivers, and ADC's capable of measuring cell voltage, and monitoring current. The DS2790's high level of integration reduces component count and board space, critical factors in the design of portable systems. The DS2790 is ideally suited for applications such as fuel gauging, sensor conditioning, and data collection.
ADDITIONAL DOCUMENTATION
Designers must have four documents to fully use all the features of this device. This data sheet contains pin descriptions, feature overviews, and electrical specifications. Errata sheets contain deviations from published specifications. The user's guides offer detailed information about device features and operation. The following documents can be downloaded from www.maxim-ic.com/DS2790. * * * * The DS2790 data sheet, which contains electrical/timing specifications and pin descriptions, available at www.maxim-ic.com/DS2790. The DS2790 errata sheet, available at www.maxim-ic.com/errata. The MAXQ Family User's Guide, which contains detailed information on core features and operation, including programming. The MAXQ Family User's Guide: DS2790 Supplement, which contains detailed information on features specific to the DS2790.
DEVELOPMENT AND TECHNICAL SUPPORT
A variety of highly versatile, affordably priced development tools for this microcontroller are available from Maxim/Dallas Semiconductor and third-party suppliers, including: * * * * * Compilers In-circuit emulators Integrated development environments (IDEs) Serial-to-JTAG converters for programming and debugging USB-to-JTAG converters for programming and debugging
Technical support is available through email at batterymanagement.support@dalsemi.com
40 of 41
DS2790 Programmable 1-Cell Li-Ion Fuel Gauge and Protector
PIN CONFIGURATION
DS2790G+ NC NC CP PLS DC CC SCL SDA TDI/INT0/P0.0 TMS/INT1/P0.1 SNS2 IS2 NC NC
1 2 3 4 5 6 7 28 27 26 25 24 23 22
DS2790E+ NC NC VIN VDD P0.5 P0.4/TDO P0.3/TCLK P0.2/RST VSS AVSS SNS1 IS1 NC NC NC NC CP PLS DC CC SCL SDA TDI/INT0/P0.0 TMS/INT1/P0.1 SNS2 IS2 NC NC
1 2 3 4 5 6 7 8 9 10 11 12 13 14 28 27 26 25 24 23 22 21 20 19 18 17 16 15
NC NC VIN VDD P0.5 P0.4/TDO P0.3/TCLK P0.2/RST VSS AVSS SNS1 IS1 NC NC
PAD
8 9 10 11 12 13 14 21 20 19 18 17 16 15
8mm x 4mm TDFN-28
TSSOP 28
PACKAGE INFORMATION
(The package drawing(s) in this data sheet may not reflect the most current specifications. For the latest package outline information, go to www.maxim-ic.com/DallasPackInfo.) Purchase of I2C components from Maxim Integrated Products, Inc., or one of its sublicensed Associate Companies, conveys a license under the Philips I2C Patent Rights to use these components in an I2C system, provided that the system conforms to the I2C Standard Specification defined by Philips.
41 of 41


▲Up To Search▲   

 
Price & Availability of DS2790

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X